package cn.ikun.dhj.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class AppJdbcUpdate {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/shixi", "root", "root");
        //更新的sql
        String sql = "UPDATE `user` SET `username` = 'ggdog' WHERE id = 2";
        Statement statement = connection.createStatement();
        int i = statement.executeUpdate(sql);
        if (i>0){
            System.out.println("更新成功");
        }

    }
}
